home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_01
/
1101097a
< prev
next >
Wrap
Text File
|
1992-11-01
|
869b
|
44 lines
// fa5.h - a dynamic array of float using a
// subscripting object
#include <iostream.h>
class fa_index
{
friend class float_array;
public:
fa_index &operator=(float f);
operator float();
private:
fa_index(float_array *f, size_t i);
float_array *fa;
size_t ix;
};
class float_array
{
friend class fa_index;
public:
float_array(size_t n = 0);
float_array(const float_array &fa);
~float_array();
float_array &operator=(const float_array &fa);
float operator[](size_t i) const;
fa_index operator[](size_t i);
inline size_t length() const;
private:
void extend(size_t i);
float *array;
size_t len;
};
ostream &operator<<(ostream &os, const float_array &fa);
inline size_t float_array::length() const
{
return len;
}
----------